package ocean.chinacraft.common;

import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.*;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import ocean.chinacraft.common.config.GroupDefine;
import ocean.chinacraft.common.constants.Constants;
import ocean.chinacraft.common.world.item.ModHammer;
import ocean.chinacraft.common.world.item.ModSilkWorm;
import ocean.chinacraft.common.world.item.armor.SilkNightArmor;
import ocean.chinacraft.common.world.item.armor.base.ArmorMaterial;
import ocean.chinacraft.common.world.item.decoration.SkyLantern;
import ocean.chinacraft.common.world.item.festival.Firecracker;
import ocean.chinacraft.common.world.item.food.MoonCake;
import ocean.chinacraft.common.world.item.jade.HibiscusJade;
import ocean.chinacraft.common.world.item.jade.Jade;
import ocean.chinacraft.common.world.item.jade.Jasper;
import ocean.chinacraft.common.world.item.jade.PurpleJade;
import ocean.chinacraft.common.world.item.spell.*;
import ocean.chinacraft.common.world.item.tool.*;
import ocean.chinacraft.common.world.item.tool.base.ModHammerTier;
import ocean.chinacraft.common.world.item.tool.base.ModItemTier;
import ocean.chinacraft.common.world.item.tree.MulberryLog;
import ocean.chinacraft.common.world.item.tree.MulberryPlanks;

/**
 * 物品加载
 *
 * @author zhang
 * @since 2021/11/3
 */
public class ModItems {

    public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS,
            Constants.MOD_ID);

    /**
     * 打粉器
     */
    public static final RegistryObject<Item> POWDER = ITEMS.register("powder", Powder::new);

    /**
     * 石锤子
     */
    public static final RegistryObject<Item> STONE_HAMMER = ITEMS.register("stone_hammer",
            () -> new ModHammer(ModHammerTier.STONE_HAMMER, -1, -3,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 铁锤子
     */
    public static final RegistryObject<Item> IRON_HAMMER = ITEMS.register("iron_hammer",
            () -> new ModHammer(ModHammerTier.IRON_HAMMER, -1, -3,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 青铜锤子
     */
    public static final RegistryObject<Item> BRONZE_HAMMER = ITEMS.register("bronze_hammer",
            () -> new ModHammer(ModHammerTier.BRONZE_HAMMER, -1, -3,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 钻石锤子
     */
    public static final RegistryObject<Item> DIAMOND_HAMMER = ITEMS.register("diamond_hammer",
            () -> new ModHammer(ModHammerTier.DIAMOND_HAMMER, -1, -3,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 青铜大刀
     */
    public static final RegistryObject<Item> BIG_BRONZE_SWORD = ITEMS.register("big_bronze_sword",
            () -> new SwordItem(ModItemTier.BIG_BRONZE_SWORD, 3, -2.4F,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 狼牙棒
     */
    public static final RegistryObject<Item> MACE = ITEMS.register("mace",
            () -> new SwordItem(ModItemTier.MACE, 3, -2.4F,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 九曲镋
     */
    public static final RegistryObject<Item> JIU_QU_TANG = ITEMS.register("jiu_qu_tang",
            () -> new SwordItem(ModItemTier.JIU_QU_TANG, 3, -2.4F,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 炎龙巨刀
     */
    public static final RegistryObject<Item> YAN_LONG_BIG_KNIFE = ITEMS.register("yan_long_big_knife",
            DragonGiantKnife::new);

    /**
     * 青铜大刀 - 翡翠
     */
    public static final RegistryObject<Item> BRONZE_SWORD_JADE = ITEMS.register("bronze_sword_jade",
            BronzeSwordJade::new);

    /**
     * 青铜大刀 - 碧玉
     */
    public static final RegistryObject<Item> BRONZE_SWORD_JASPER = ITEMS.register("bronze_sword_jasper",
            BronzeSwordJasper::new);

    /**
     * 青铜大刀 - 芙蓉玉
     */
    public static final RegistryObject<Item> BRONZE_SWORD_HIBISCUS = ITEMS.register("bronze_sword_hibiscus",
            BronzeSwordHibiscus::new);

    /**
     * 青铜大刀 - 紫玉
     */
    public static final RegistryObject<Item> BRONZE_SWORD_PURPLE = ITEMS.register("bronze_sword_purple",
            BronzeSwordPurple::new);

    /**
     * 禅杖
     */
    public static final RegistryObject<Item> ZEN_STICK = ITEMS.register("zen_stick", ZenStick::new);

    /**
     * 翡翠玉
     */
    public static final RegistryObject<Item> JADE = ITEMS.register("jade", Jade::new);

    /**
     * 碧玉
     */
    public static final RegistryObject<Item> JASPER = ITEMS.register("jasper", Jasper::new);

    /**
     * 芙蓉玉
     */
    public static final RegistryObject<Item> HIBISCUS_JADE = ITEMS.register("hibiscus_jade", HibiscusJade::new);

    /**
     * 紫玉
     */
    public static final RegistryObject<Item> PURPLE_JADE = ITEMS.register("purple_jade", PurpleJade::new);

    /**
     * 铜锭
     */
    public static final RegistryObject<Item> COPPER_INGOT = ITEMS.register("copper_ingot",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 锡锭
     */
    public static final RegistryObject<Item> TIN_INGOT = ITEMS.register("tin_ingot",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 银锭
     */
    public static final RegistryObject<Item> SILVER_INGOT = ITEMS.register("silver_ingot",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 青铜锭
     */
    public static final RegistryObject<Item> BRONZE_INGOT = ITEMS.register("bronze_ingot",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 青砖
     */
    public static final RegistryObject<Item> BLACK_BRICK = ITEMS.register("black_brick",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 黏土沙混合物
     */
    public static final RegistryObject<Item> CLAY_SAND_MIXTURE = ITEMS.register("clay_sand_mixture",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 锡粉
     */
    public static final RegistryObject<Item> TIN_POWDER = ITEMS.register("tin_powder",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 铜粉
     */
    public static final RegistryObject<Item> COPPER_POWDER = ITEMS.register("copper_powder",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 青铜粉
     */
    public static final RegistryObject<Item> BRONZE_POWDER = ITEMS.register("bronze_powder",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 耐火砖
     */
    public static final RegistryObject<Item> FIRE_BRICK = ITEMS.register("fire_brick",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 已杀青的竹子
     */
    public static final RegistryObject<Item> PEELED_BAMBOO = ITEMS.register("peeled_bamboo",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 盐
     */
    public static final RegistryObject<Item> SALT = ITEMS.register("salt",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 黑狗血
     * <p>
     * TODO 获得途径
     */
    public static final RegistryObject<Item> BLACK_DOG_BLOOD = ITEMS.register("black_dog_blood",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_MISC)));

    /**
     * 面粉
     */
    public static final RegistryObject<Item> FLOUR = ITEMS.register("flour",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_AGRICULTURE)));

    /**
     * 米粉
     */
    public static final RegistryObject<Item> RICES_FLOUR = ITEMS.register("rices_flour",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_AGRICULTURE)));

    /**
     * 大豆
     */
    public static final RegistryObject<Item> SOY = ITEMS.register("soy",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_AGRICULTURE)));

    /**
     * 豆荚
     */
    public static final RegistryObject<Item> SOY_POD = ITEMS.register("soy_pod",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_AGRICULTURE)));

    /**
     * 桑木木头
     */
    public static final RegistryObject<Item> MULBERRY_LOG = ITEMS.register("mulberry_log", MulberryLog::new);

    /**
     * 桑木木板
     */
    public static final RegistryObject<Item> MULBERRY_PLANKS = ITEMS.register("mulberry_planks", MulberryPlanks::new);

    /**
     * 桑叶
     */
    public static final RegistryObject<Item> MULBERRY_LEAF = ITEMS.register("mulberry_leaf",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_AGRICULTURE)));

    /**
     * 蚕卵
     */
    public static final RegistryObject<Item> SILKWORM_EGG = ITEMS.register("silkworm_egg",
            () -> new ModSilkWorm(new Item.Properties().tab(GroupDefine.CHINACRAFT_SILK)));

    /**
     * 青铜头盔
     */
    public static final RegistryObject<Item> BRONZE_HEAD = ITEMS.register("bronze_head",
            () -> new ArmorItem(ArmorMaterial.BRONZE_ARMOR, EquipmentSlotType.HEAD,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 青铜胸甲
     */
    public static final RegistryObject<Item> BRONZE_CHEST = ITEMS.register("bronze_chest",
            () -> new ArmorItem(ArmorMaterial.BRONZE_ARMOR, EquipmentSlotType.CHEST,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 青铜护腿
     */
    public static final RegistryObject<Item> BRONZE_LEGGINGS = ITEMS.register("bronze_leggings",
            () -> new ArmorItem(ArmorMaterial.BRONZE_ARMOR, EquipmentSlotType.LEGS,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 青铜靴子
     */
    public static final RegistryObject<Item> BRONZE_FEET = ITEMS.register("bronze_feet",
            () -> new ArmorItem(ArmorMaterial.BRONZE_ARMOR, EquipmentSlotType.FEET,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 夜行衣头罩
     */
    public static final RegistryObject<Item> NIGHT_CLOTHES_HEAD = ITEMS.register("night_clothes_head",
            () -> new SilkNightArmor(ArmorMaterial.SILK_NIGHT_ARMOR, EquipmentSlotType.HEAD,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 夜行衣胸衣
     */
    public static final RegistryObject<Item> NIGHT_CLOTHES_CHEST = ITEMS.register("night_clothes_chest",
            () -> new SilkNightArmor(ArmorMaterial.SILK_NIGHT_ARMOR, EquipmentSlotType.CHEST,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 夜行衣绑腿
     */
    public static final RegistryObject<Item> NIGHT_CLOTHES_LEGS = ITEMS.register("night_clothes_legs",
            () -> new SilkNightArmor(ArmorMaterial.SILK_NIGHT_ARMOR, EquipmentSlotType.LEGS,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 夜行衣护腿
     */
    public static final RegistryObject<Item> NIGHT_CLOTHES_FEET = ITEMS.register("night_clothes_feet",
            () -> new SilkNightArmor(ArmorMaterial.SILK_NIGHT_ARMOR, EquipmentSlotType.FEET,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_ARMOR)));

    /**
     * 玉石切割刀
     */
    public static final RegistryObject<Item> JADE_CUTTING_KNIFE = ITEMS.register("jade_cutting_knife",
            JadeCuttingKnife::new);

    /**
     * 美术切割刀
     */
    public static final RegistryObject<Item> ART_CUTTING_KNIFE = ITEMS.register("art_cutting_knife",
            ArtCuttingKnife::new);

    /**
     * 青铜稿子
     */
    public static final RegistryObject<Item> BRONZE_PICKAXE = ITEMS.register("bronze_pickaxe",
            () -> new PickaxeItem(ModItemTier.BRONZE_PICKAXE, 1, -2.8F,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 青铜斧头
     */
    public static final RegistryObject<Item> BRONZE_AXE = ITEMS.register("bronze_axe",
            () -> new AxeItem(ModItemTier.BRONZE_AXE, 1, -2.8F,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 青铜铲子
     */
    public static final RegistryObject<Item> BRONZE_SHOVEL = ITEMS.register("bronze_shovel",
            () -> new ShovelItem(ModItemTier.BRONZE_SHOVEL, 1, -2.8F,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 青铜锄头
     */
    public static final RegistryObject<Item> BRONZE_HOE = ITEMS.register("bronze_hoe",
            () -> new HoeItem(ModItemTier.BRONZE_HOE, 1, -2.8F,
                    new Item.Properties().tab(GroupDefine.CHINACRAFT_TOOL).stacksTo(1)));

    /**
     * 月饼
     */
    public static final RegistryObject<Item> MOON_CAKE = ITEMS.register("moon_cake", MoonCake::new);

    /**
     * 木桶
     */
    public static final RegistryObject<Item> WOOD_BUCKET = ITEMS.register("wood_bucket",
            () -> new WoodBucket(() -> Fluids.EMPTY,
                    (new Item.Properties()).stacksTo(1).tab(GroupDefine.CHINACRAFT_AGRICULTURE)));

    /**
     * 木水桶
     */
    public static final RegistryObject<Item> WOOD_WATER_BUCKET = ITEMS.register("wood_water_bucket",
            () -> new WoodBucket(() -> Fluids.WATER,
                    (new Item.Properties()).stacksTo(1).tab(GroupDefine.CHINACRAFT_AGRICULTURE).craftRemainder(WOOD_BUCKET.get())));

    /**
     * 灵符
     */
    public static final RegistryObject<Item> SPIRIT_SPELL = ITEMS.register("spirit_spell",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_SPELL)));

    /**
     * 火符
     */
    public static final RegistryObject<Item> FIRE_SPELL = ITEMS.register("fire_spell", FireSpell::new);

    /**
     * 金睛符
     */
    public static final RegistryObject<Item> NIGHT_SPELL = ITEMS.register("night_spell", NightSpell::new);

    /**
     * 毒符
     */
    public static final RegistryObject<Item> POISON_SPELL = ITEMS.register("poison_spell", PoisonSpell::new);

    /**
     * 能量符
     */
    public static final RegistryObject<Item> POWER_SPELL = ITEMS.register("power_spell", PowerSpell::new);

    /**
     * 命符
     */
    public static final RegistryObject<Item> HEAL_SPELL = ITEMS.register("heal_spell", HealSpell::new);

    /**
     * 护符
     */
    public static final RegistryObject<Item> PROTECT_SPELL = ITEMS.register("protect_spell", ProtectSpell::new);

    /**
     * 混沌符
     */
    public static final RegistryObject<Item> CHAOTIC_SPELL = ITEMS.register("chaotic_spell", ChaoticSpell::new);

    /**
     * 黑色丝绸
     */
    public static final RegistryObject<Item> BLACK_SILK = ITEMS.register("black_silk",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_SILK)));

    /**
     * 蚕蛹
     */
    public static final RegistryObject<Item> SILKWORM_CHRYSALIS = ITEMS.register("silkworm_chrysalis",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_SILK)));

    /**
     * 幼蚕
     */
    public static final RegistryObject<Item> YOUNG_SILKWORM = ITEMS.register("young_silkworm",
            () -> new ModSilkWorm(new Item.Properties().tab(GroupDefine.CHINACRAFT_SILK)));

    /**
     * 生丝
     */
    public static final RegistryObject<Item> RAW_SILK = ITEMS.register("raw_silk",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_SILK)));

    /**
     * 丝绸
     */
    public static final RegistryObject<Item> SILK = ITEMS.register("silk",
            () -> new Item(new Item.Properties().tab(GroupDefine.CHINACRAFT_SILK)));

    /**
     * 死掉的蚕
     */
    public static final RegistryObject<Item> DEAD_SILKWORM = ITEMS.register("dead_silkworm",
            () -> new ModSilkWorm(new Item.Properties().tab(GroupDefine.CHINACRAFT_SILK)));

    /**
     * 孔明灯
     */
    public static final RegistryObject<SkyLantern> SKY_LANTERN = ITEMS.register("sky_lantern", SkyLantern::new);

    /**
     * 鞭炮
     */
    public static final RegistryObject<Item> FIRE_CRACKER = ITEMS.register("fire_cracker", Firecracker::new);

    public static void register(IEventBus bus) {
        ITEMS.register(bus);
    }
}